{extend name="Base/base"/}
{block name="body"}
	<div class="main-title">
        <h2>{:lang("_USER_GROUP_AUTHORIZATION_")}</h2>
	</div>

    <div id="auth_groups" class="with-padding">
        <form class="form-horizontal" action="{:URL('addToGroup')}" method="post" enctype="application/x-www-form-urlencoded" >
			<label class="item-label">{$nickname}{:lang("_USER_GROUP_LIST_")}</label>
            <div class="clearfix">
                {volist name="auth_groups" id="vo"}
                    <label class="checkbox checkbox-inline">
                        <input class="auth_groups" type="checkbox" name="group_id[]" value="{$vo.id}">{$vo.title}
                    </label>
                {/volist}
            </div>

            <input type="hidden" name="uid" value="{:I('uid')}">
            <input type="hidden" name="batch" value="true">
            <div style="margin-top: 10px;">
                <button type="submit" class="btn submit-btn ajax-post" target-form="form-horizontal">{:lang("_SURE_WITH_SPACE_")}</button>
                <button class="btn btn-return" onclick="javascript:history.back(-1);return false;">{:lang("_RETURN_WITH_SPACE_")}</button>
            </div>
        </form>
    </div>
{block}
{block name="script"}
<script type="text/javascript">
    $(function(){
        var group = [{$user_groups}];
        $('.auth_groups').each(function(){
            if( $.inArray( parseInt(this.value,10),group )>-1 ){
                $(this).prop('checked',true);
            }
        });
    });
    // 导航高亮
    highlight_subnav('{:URL('User/index')}');
</script>
{/block}
